Next: , Previous: Working With Source Code, Up: Working With Source Code


14.1 Structure of code blocks

The structure of code blocks is as follows:

     #+srcname: <name>
     #+begin_src <language> <switches> <header arguments>
       <body>
     #+end_src

code blocks can also be embedded in text as so called inline code blocks as

     src_<language>{<body>}

or

     src_<language>[<header arguments>]{<body>}
<name>
This name is associated with the code block. This is similar to the ‘#+tblname’ lines that can be used to name tables in Org-mode files. Referencing the name of a code block makes it possible to evaluate the block from other places in the file, other files, or from Org-mode table formulas (see The spreadsheet).
<language>
The language of the code in the block.
<switches>
Switches controlling exportation of the code block (see switches discussion in Literal examples)
<header arguments>
Optional header arguments control many aspects of evaluation, export and tangling of code blocks. See the Header arguments section. Header arguments can also be set on a per-buffer or per-subtree basis using properties.
<body>
The source code.